import os
class DEVICE_BASE:
    port=None
    """
    设备基类,实现一些公共功能,和声明一些空方法
    """
    def __init__(self,host,username,password):
        """
            和数据库对象 传入设备配置信息
        """
        self.host=host
        self.username=username
        self.password=password
        self.device_id=device_id
        pass
    def images(self,path_file):
        if os.path.isfile(path_file):
            with open(path_file, 'rb') as f:
                image_raw_data = f.read()
            return image_raw_data

    def conn():
        """
            连接设备
        """
        pass
    def delete_person(self,person_id):
        """
            删除人员
        """
        pass
    def create_person(self,person_id,pname,*image):
        """
            创建人员
        """
        pass
    def insert_person_image(self,person_id,*image):
        """
            添加人员照片
        """
        pass
    def delete_person_image(self,person_id,*image_id):
        """
            删除人员照片 最后一张无法删除
        """
        pass
    def access_records(self,callBack):
        """
            获取通行记录
        """
        pass
    def open_door(self):
        """
            开门
        """
        pass